﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link rel="stylesheet" type="text/css" href="css/styles.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/tools.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript" src="js/jquery.corner.js"></script>
<style type="text/css">
	button:hover{
		background-color: red;
	}
</style>
<script type="text/javascript">
		function checkValue(){
			if($("#produceName").val().length<=0){
				alert("产品名称不能为空");
			}else if($("#producePrice").val().length<=0){
				alert("产品价格不能为空");
			}else if(isNaN($("#producePrice").val())){
				alert("价格必须为数字!");
			}else if($("#image").val().length<=0){
				alert("产品图片不能为空");
			}else if($("#produceNote").val().length<=0){
				alert("产品描述不能为空!");
			}
			else if($("#produceNote").val().length>200){
				alert("产品描述长度不能超过200!");
			}else if($("#produceNote").val().length<20){
				alert("产品描述长度不能小于20!");
			}else{
				addForm.submit();
			}
		}
	</script>
</head>
<body>
	
		<div align="center" style="height: 220px;">
		<div id="top" style="width:950px;">
			<img src="images/logo.jpg" width="950" height="150" border="0" />
			<p style="font-size: 14px;float: left;">
				您当前的位置:&nbsp;&nbsp;<a href="findProductAction">首页</a>&nbsp;&nbsp;>>&nbsp;&nbsp;添加产品&nbsp;&nbsp;
			</p>
		</div>
	</div>
		<!-- 中-->
		<div align="center">
			<s:form action="addProAction" method="post" enctype="multipart/form-data" name="addForm">
				<s:textfield label="产品名称" name="produceName" id="produceName" maxlength="10"/>
				<s:textfield label="产品价格" name="producePrice" id="producePrice"/>
				<s:file name="image" label="请选择一张图片" id="image"/>
				<s:textarea label="产品描述" cols="60" rows="20" name="produceNote" id="produceNote"/>
			</s:form>
			<input type="button" onclick="checkValue()" class="btn" value="添加"/>
		</div>
	<hr width="100%" style="color:#ccc;float: left;position: relative;top:20px;" />
	<br />
	<div align="center" style="width: 100%;float: left;position: relative;top: 20px;">
		<a href="#" style="text-decoration:none;color:#666;font-size: 14px;">联系我们</a>&nbsp;&nbsp;|&nbsp;&nbsp;
		<a href="#" style="text-decoration:none;color:#666;font-size: 14px;">加入我们</a>&nbsp;&nbsp;|&nbsp;&nbsp;
		<s:if test="#session.ui!=null">
			<a href="exitAction"
				style="text-decoration:none;color:#666;font-size: 14px;">【退出】</a>
		</s:if>
		<s:else>
			<a href="javascript:showBox('登录','login()')"
				style="text-decoration:none;color:#666;font-size: 14px;">管理员入口</a>
		</s:else>
		<br /> <br /> <br />
	</div>
</body>
</html>